﻿//初始化组织结构
function initTree(id, url, param, clickFun) {
    var setting = {
        data: { simpleData: { enable: true } },
        callback: { onClick: function (e, treeId, treeNode) { if ($.isFunction(clickFun)) clickFun(treeNode) } }
    };

    $.post(url, param, function (zNodes) {
        var zTree = $.fn.zTree.init($('#' + id), setting, zNodes);
        var treeRoot = zTree.getNodeByParam("level", 0, null);            
        zTree.updateNode(treeRoot);
        zTree.expandAll(true);
    });
}
